package com.xiangyao.train.utils

import io.reactivex.Observable
import io.reactivex.ObservableTransformer
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit


/**
 * Created by xiangyao on 2017/12/07.
 * 切换线程的工具
 */

object RxScedulerHelper {

    fun <T> io_main(): ObservableTransformer<T, T> {

        return ObservableTransformer { upStream: Observable<T> ->
            upStream.delay(500,TimeUnit.MICROSECONDS).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
        }
    }


}
